package com.dcy.prototype.improve;


/**
 * @Author：dcy
 * @Description:
 * @Date: 2021/1/20 15:38
 */
public class Client {
    public static void main(String[] args) {
        System.out.println("用的是原型模式完成对象的创建");
        Sheep sheep = new Sheep("tom", 1, "白色");
        sheep.setFriend(new Sheep("jack", 2, "黑色"));
        Sheep sheep1 = (Sheep) sheep.clone(); // 克隆
        Sheep sheep2 = (Sheep) sheep.clone(); // 克隆
        Sheep sheep3 = (Sheep) sheep.clone(); // 克隆
        Sheep sheep4 = (Sheep) sheep.clone(); // 克隆
        Sheep sheep5 = (Sheep) sheep.clone(); // 克隆

        System.out.println(sheep);
        System.out.println(sheep1);
        System.out.println(sheep2);
        System.out.println(sheep3);
        System.out.println(sheep4);
        System.out.println(sheep5);
    }
}
